package com.wgts.wgts.mvp.presenter.imp;

import com.wgts.wgts.mvp.model.IMoreMoreAffirmOrderActivityModel;
import com.wgts.wgts.mvp.presenter.IMoreMoreAffirmOrderActivityPresenter;
import com.wgts.wgts.mvp.view.IMoreMoreAffirmOrderActivityView;
import com.wgts.wgts.netmodle.HttpResultSubscriber;
import com.wgts.wgts.netmodle.resp.AwardWinner;
import com.wgts.wgts.netmodle.resp.CurrentEntity;

public class MoreMoreAffirmOrderActivityPresenter implements IMoreMoreAffirmOrderActivityPresenter {

    private IMoreMoreAffirmOrderActivityView view;

    private IMoreMoreAffirmOrderActivityModel model;


    public MoreMoreAffirmOrderActivityPresenter(IMoreMoreAffirmOrderActivityView view, IMoreMoreAffirmOrderActivityModel model) {
        this.view = view;
        this.model = model;
    }


    @Override
    public void awardWinner(Integer winId) {
        model.awardWinner(winId, new HttpResultSubscriber<AwardWinner>() {
            @Override
            public void onSuccess(AwardWinner awardWinner) {
                view.awardWinner(awardWinner);
            }

            @Override
            public void _onError(int status, String msg) {
                view.onError(status, msg);
            }
        });
    }

    @Override
    public void awardEnsure(Integer winId, String addressId) {
        model.awardEnsure(winId, addressId, new HttpResultSubscriber<CurrentEntity>() {
            @Override
            public void onSuccess(CurrentEntity currentEntity) {
                view.awardEnsure();
            }

            @Override
            public void _onError(int status, String msg) {
                view.onError(status, msg);
            }
        });
    }
}
